package com.cskaoyan.day1.generic3;

/**
 * @author Common-zhou
 * @since 2023-02-27 10:01
 */
public class Holder2Demo {
    public static void main(String[] args) {
        testAutoCar();

        testTruck();
    }

    private static void testTruck() {
        Holder2 holder2 = new Holder2(new Truck());

        holder2.get().run();
    }

    private static void testAutoCar() {
        Holder2 holder2 = new Holder2(new AutoCar());

        Car car = holder2.get();
        car.run();

        AutoCar car1 = (AutoCar) car;
        car1.addOil();
    }
}
